<%@page import="servlets.MainServlet"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<link href="../css/verEnvio.css" rel="stylesheet" type="text/css">
<link href="../css/button.css" rel="stylesheet" type="text/css">
<jsp:include page="header.jsp" flush="true" />
<div id="content">
	<div class="bootstrap-frm">
		<h1>Sucursal</h1>
		
		<label> 
			<span class="label">Número:</span>
			<span class="valor"><c:out value="${sucursal.numeroSucursal}"/></span>
		</label>	
		<label> 
			<span class="label">Nombre:</span>
			<span class="valor"><c:out value="${sucursal.nombre}"/></span>
		</label>
	</div>
	<br/>				    
    <div class="bootstrap-frm">
		<h1>Depósitos Disponibles</h1>
		<c:choose>
			<c:when test="${fn:length(sucursal.depositos) gt 0}">
				<c:forEach items="${sucursal.depositos}" var="deposito" varStatus="status">
					<label> 
						<span class="label">Depósito:</span>
						<span class="valor"><c:out value="${deposito.codigoDeposito}"/></span>
					</label>
					<label>
						<span class="label">Refrigerado:</span>
						<span class="valor">
							<c:choose>
								<c:when test="${deposito.refrigerado == 1 }">
									Sí
							    </c:when>       
							    <c:otherwise>
							    	No
							    </c:otherwise>
							</c:choose>
						</span>
					</label>
					<label>
						<span class="label">Fragilidad:</span>
						<span class="valor">
							<c:choose>
								<c:when test="${deposito.fragilidad == 1 }">
									Extremadamente Frágil
							    </c:when>
							    <c:when test="${deposito.fragilidad == 2 }">
							    	Frágil
							    </c:when>
							    <c:when test="${deposito.fragilidad == 3 }">
							    	Normal
							    </c:when>              
							    <c:otherwise>
							    	Resistente
							    </c:otherwise>
							</c:choose>
						</span>
					</label>
					<label>
						<span class="label">Peligrosidad:</span>
						<span class="valor">
							<c:choose>
								<c:when test="${deposito.peligrosidad == 1 }">
									Extremadamente Peligroso
							    </c:when>
							    <c:when test="${deposito.peligrosidad == 2 }">
							    	Peligroso
							    </c:when>
							    <c:when test="${deposito.peligrosidad == 3 }">
							    	Inocuo
							    </c:when>              
							</c:choose>
						</span>
					</label>
					<c:choose>
						<c:when test="${deposito.envio != null }">
							<label>
								<span class="label">Estado</span>
								<span class="value" style="color: red;font-weight: bold;">ocupado</span>
							</label>
							<c:choose>
								<c:when test="${deposito.envio.enDestino}">
									<label style="margin-left: 135px;">
										<span>Envío en destino a la espera de ser retirado</span>
									</label>
								</c:when>
								<c:otherwise>
									<label style="margin-left: 135px;">
										<span>Envío a la espera de la conformación de un viaje</span>
									</label>
								</c:otherwise>
							</c:choose>			
							<a href="../servlet/mainServlet?actionId=3&envioId=<c:out value="${deposito.envio.envioId}"/>" class="myButton" style="margin-left: 135px;">Ver Envio</a>
						</c:when>
						<c:otherwise>
							<label>
								<span class="label">Estado</span>
								<span class="value" style="color: green; font-weight: bold;">libre</span>
							</label>
						</c:otherwise>
					</c:choose>
					<hr/><br/>
				</c:forEach>
			</c:when>
			<c:otherwise>
				No se registran depositos disponibles
			</c:otherwise>
		</c:choose>
	</div>
</div>
<jsp:include page="footer.jsp" flush="true" />